package br.biofoco.p2p.dht;

import br.biofoco.p2p.peer.PeerNode;
import br.biofoco.p2p.rpc.Message;

public class MessageBuilder {
	
	private String command;
	private PeerNode from;
	private PeerNode to;

	private MessageBuilder() {}

	public static MessageBuilder newMessage() {
		return new MessageBuilder();
	}

	public MessageBuilder withCommand(String command) {
		this.command = command;
		return this;
	}

	public MessageBuilder from(PeerNode peerNode) {
		this.from = peerNode;
		return this;
	}

	public MessageBuilder to(PeerNode peerNode) {
		this.to = peerNode;
		return this;
	}

	public Message create() {
		return new Message(command, from, to);
	}


}
